home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2773 < prev    next >
Encoding:
Text File  |  1996-08-06  |  762 b   |  36 lines

  1. Path: oxy.rust.net!usenet
  2. From: ebennett@rust.net
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: using const for structs?
  5. Date: Fri, 19 Jan 1996 03:56:41 GMT
  6. Organization: Rust Net - High Speed Internet in Detroit  810-642-2276
  7. Message-ID: <4dmq70$jov@oxy.rust.net>
  8. References: <4dm36c$c1h@zdi.informatik.uni-stuttgart.de>
  9. NNTP-Posting-Host: liv-13.rust.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Gerhard Muth <muth> wrote:
  13.  
  14. >> Stuff Deleted
  15.  
  16. >struct box {
  17. >    float width, heigth; // float was int before
  18. >};
  19.  
  20. >const box blue_box();
  21. >const box pink_box(1.0, 4.5); // this is line 35
  22.  
  23. >void main(void) {}
  24.  
  25. Add the line:
  26.  
  27.    box(float w, float h) : width(w), heigth(h) {};
  28.  
  29. to the struct definition, and this should compile OK.
  30.  
  31. Seems like an omission in the book.
  32.  
  33. Earl
  34.  
  35.  
  36.